home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / usplash < prev    next >
Text File  |  2008-10-08  |  3KB  |  115 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          usplash
  4. # Required-Start:    $all
  5. # Required-Stop:     $all
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:      0 1 6
  8. # Short-Description: Integrate usplash into the boot process
  9. # Description: This script deals with some awkward details of integrating
  10. #              the userspace bootsplash screen into the boot process. On
  11. #              start it stops the usplash daemon (counter-intuitive, but
  12. #              usplash was already started in the initramfs); on stop, it
  13. #              calls usplash_down (unless usplash is already running).
  14. ### END INIT INFO
  15. # The usplash script makes sure that usplash exits at the end of 
  16. # the boot sequence and re-run the console-screen.sh script to make
  17. # sure that the console fonts are actually set
  18. #
  19. #        Written by Miquel van Smoorenburg <miquels@cistron.nl>.
  20. #        Modified for Debian 
  21. #        by Ian Murdock <imurdock@gnu.ai.mit.edu>.
  22. #
  23. # Version:    @(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
  24. #
  25.  
  26. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  27. DAEMON=/sbin/usplash
  28. NAME=usplash
  29. DESC="Userspace bootsplash utility"
  30.  
  31. test -x $DAEMON || exit 0
  32.  
  33. set -e
  34.  
  35. usplash_quit() {
  36.     # first some sanity checks if we actually have usplash on the system
  37.     # 
  38.     # check if usplash is runing and if it does, exit it
  39.     # then re-run console-screen.sh because it can't set console-fonts
  40.     # properly while the screen is in graphics mode
  41.     # 
  42.     # also check if we are ended up in console 8. This means that 
  43.     # no gdm/kdm/xdm was started (otherwise we would be on vt7).
  44.     # It happens when e.g. usplash timed out
  45.     if type setupcon >/dev/null 2>&1; then
  46.         CONSOLE_SCREEN=
  47.     elif [ -x /etc/init.d/console-screen.sh ]; then
  48.         CONSOLE_SCREEN="/etc/init.d/console-screen.sh start"
  49.     else
  50.         CONSOLE_SCREEN=
  51.     fi
  52.     if type usplash >/dev/null 2>&1 && 
  53.            ( pidof usplash > /dev/null || [ "$(fgconsole 2>/dev/null)" = "8" ] ); then
  54.            # Clear VT 8 of any console messages
  55.         clear >/dev/tty8
  56.  
  57.         # ask usplash to go away
  58.         usplash_write QUIT
  59.  
  60.         # wait until it is really gone or kill it if it dosn't exit
  61.         i=0
  62.         while pidof usplash > /dev/null; do
  63.             i=$(($i + 1))
  64.             if [ $i -gt 10 ]; then
  65.                 kill -9 `pidof usplash`
  66.                 break
  67.             fi
  68.             sleep 1
  69.         done
  70.  
  71.         # reset all our virtual consoles, yay!
  72.         if [ "$CONSOLE_SCREEN" ]; then
  73.             $CONSOLE_SCREEN
  74.         fi
  75.         if [ "$(fgconsole 2>/dev/null)" = "8" ] && [ "$DO_NOT_SWITCH_VT" != "yes" ]; then
  76.             chvt 1
  77.         fi
  78.     fi
  79. }
  80.  
  81. case "$1" in
  82.   start)
  83.     usplash_quit
  84.     ;;
  85.   stop)
  86.     SPLASH=false
  87.     if [ -f /proc/cmdline ] ; then
  88.         for x in $(cat /proc/cmdline); do
  89.         case $x in
  90.             nosplash*)
  91.             SPLASH=false
  92.             ;;
  93.             splash*)
  94.             SPLASH=true
  95.             ;;
  96.         esac
  97.         done
  98.     fi
  99.  
  100.     if [ "$SPLASH" = "true" ] ; then
  101.         pidof usplash > /dev/null || usplash_down
  102.         usplash_write "TIMEOUT 15"
  103.     fi
  104.     ;;
  105.   *)
  106.     N=/etc/init.d/$NAME
  107.     # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
  108.     echo "Usage: $N {start|stop}" >&2
  109.     exit 1
  110.     ;;
  111. esac
  112.  
  113. exit 0
  114.